package parcomb

import parcomb.*;
import java.util.ArrayList
import java.util.Collections
import kotlin.io.*
import java.io.FileInputStream
import java.io.InputStreamReader
import testaux.*

fun parse(fileName: String): Program {
    val reader = InputStreamReader(FileInputStream(fileName), "UTF-8")
    val s = reader.readText()
    val l = program()(s.toCharList())
    return l.first!!.first.get(0);
}

fun main(args: Array<String>) {
    //val s = "   \t\n\r   ajfleijf83f ' f3".toCharList()
    //println(bind1(spaces(), {(_: List<Char>?) -> ident()})(s))
    //println(seq(many(whitespace()), ident())(s))

    //val p = "xxx; DEF xxx(a, i) { IF [a > b] { PASS} { a = 4} } DEF aaa() { t=3}".toCharList()
    //val p = "RET a+zero()".toCharList()
    //val p = ")".toCharList();
    //print(statement()(p))
    //print(bind1(expr_list(), {(ec: ExprList?) -> bind(RPAR(), {(c: Char) -> result(ec)})})(p).toString())

}